<?php
namespace Admin\Controller;
use Think\Controller;
class MemberController extends Controller {
    public function login(){
    	if(IS_POST){
    		// show(I('username'));
    		$validate  =D('Members')->validates(I('username'),I('password'));
    		
    		if($validate){
                session('logininfo',$validate);
                //判断是否存在上次打开键接,如果有,就先跳转至之前的键接.
                if(isset($_SESSION['url'])){
                    $this->success('登陆成功',U('Admin/index'));
                }else{
                     $this->success('登陆成功',U('Admin/index'));
                }
    		}
    	}
    	
   	$this->display();
    }
    public function logout(){
        $_SESSION['logininfo'] = "";

        session_destroy();
        echo "<script>self.opener.location.reload();</script>";
        $this->success('退出成功','Member/logoin');


    }
}